package org.ysu.core;

import org.apache.ibatis.jdbc.Null;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.ysu.vo.ResultVO;

//统一异常处理
@RestControllerAdvice
public class DefaultException {
    @ExceptionHandler
    ResultVO<Null> defaultExceptionHandler(Exception ex) {
        ex.printStackTrace();
        if(ex instanceof YsuException) {
            return ResultVO.failed(ex.getMessage());
        }
        return ResultVO.failed("系统异常，请联系管理员");
    }
}
